using System;
using System.Collections.Generic;

namespace ilgolosone.Shared.IoC
{
    public static class DependencyResolver
    {
        private static IDependencyResolver _dependencyResolver;

        public static void InitializeWith(IDependencyResolver resolver)
        {
            if (resolver == null) throw new ArgumentNullException("resolver");

            _dependencyResolver = resolver;
        }

        public static TService Resolve<TService>()
        {
            return _dependencyResolver.Resolve<TService>();
        }

        public static IEnumerable<TService> ResolveAll<TService>()
        {
            return _dependencyResolver.ResolveAll<TService>();
        }

        public static void Release()
        {
            _dependencyResolver.Dispose();
        }
    }
}